package UIFree.FX.pageturner
{
	import UIFree.uif_ecomponent;
	
	import flash.filters.GlowFilter;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	
	public class pt_collectTurner extends pt_maskTurner
	{
		public static var ELEMCOUNT: int = 10;
		
		public function pt_collectTurner(parent:uif_ecomponent, a_transition:Function=null, a_fps:Number=20, a_duration:Number=1500)
		{
			super(parent, a_transition, a_fps, a_duration);
		}
		
		override protected function startFX(): void {
			endBitmap.filters = [new GlowFilter(0xFFFFFF, 1, 10, 10, 2, 2)];
			super.startFX();
		}
		
		override protected function paintMask():void {
			slideMask.graphics.clear();
			slideMask.graphics.beginFill(0xFFFFFF);
			
			var count: int = 3 + Math.round(ELEMCOUNT * state);
			var size: Point = new Point(endBitmap.width / ELEMCOUNT, endBitmap.height / ELEMCOUNT);
			
			for (var iy: int=0; iy<count; iy++)
				for (var ix: int=0; ix<count; ix++) {
					var rect: Rectangle = new Rectangle(0, 0, size.x * state, size.y * state);
					rect.x = ix * size.x + (size.x - rect.width) / 2;
					rect.y = iy * size.y + (size.y - rect.height) / 2;
					slideMask.graphics.drawRect(rect.x, rect.y, rect.width, rect.height);
					//					slideMask.graphics.drawCircle(rect.x, rect.y, size.x);
				}
		}		
	}
}